# Maintainer: Peter Budai <peterbudai@hotmail.com>

_realname=seaborn
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python2-${_realname}" "${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
pkgver=0.9.0
pkgrel=2
pkgdesc="Statistical data visualization using matplotlib (mingw-w64)"
arch=('any')
url='https://stanford.edu/~mwaskom/software/seaborn/'
license=('BSD')
makedepends=("${MINGW_PACKAGE_PREFIX}-python2"
             "${MINGW_PACKAGE_PREFIX}-python3"
             "${MINGW_PACKAGE_PREFIX}-python2-setuptools"
             "${MINGW_PACKAGE_PREFIX}-python3-setuptools"
             "${MINGW_PACKAGE_PREFIX}-python2-pandas"
             "${MINGW_PACKAGE_PREFIX}-python3-pandas"
             "${MINGW_PACKAGE_PREFIX}-python2-matplotlib"
             "${MINGW_PACKAGE_PREFIX}-python3-matplotlib"
             "${MINGW_PACKAGE_PREFIX}-python2-scipy"
             "${MINGW_PACKAGE_PREFIX}-python3-scipy"
             "${MINGW_PACKAGE_PREFIX}-python2-beautifulsoup4"
             "${MINGW_PACKAGE_PREFIX}-python3-beautifulsoup4"
             )
source=("${_realname}-${pkgver}.tar.gz::https://github.com/mwaskom/${_realname}/archive/v${pkgver}.tar.gz")
sha256sums=('e2910b86f719ceecd09350071cb68e7531d236d087d04515b961363dd7208e6f')

#noextract=("${_realname}-${pkgver}.tar.gz")

prepare() {

  for pver in {2,3}; do
    rm -rf python${pver}-build-${CARCH} | true
    cp -r "${_realname}-${pkgver}" "python${pver}-build-${CARCH}"
  done
}

build() {
  for pver in {2,3}; do
    msg "Python ${pver} build for ${CARCH}"
    cd "${srcdir}/python${pver}-build-${CARCH}"
    ${MINGW_PREFIX}/bin/python${pver} setup.py build
  done
}

package_python2-seaborn() {
  depends=("${MINGW_PACKAGE_PREFIX}-python2"
            "${MINGW_PACKAGE_PREFIX}-python2-pandas"
            "${MINGW_PACKAGE_PREFIX}-python2-matplotlib"
            )
  optdepends=("${MINGW_PACKAGE_PREFIX}-python2-statsmodel: for some advanced statistical plots"
              "${MINGW_PACKAGE_PREFIX}-python2-beautifulsoup4: for getting dataset names"
            )

  cd "${srcdir}/python2-build-${CARCH}"
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python2 setup.py install --prefix=${MINGW_PREFIX} \
    --root="${pkgdir}" --optimize=1 --skip-build

  install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python2-${_realname}/LICENSE.txt"
}

package_python3-seaborn() {
  depends=("${MINGW_PACKAGE_PREFIX}-python3"
            "${MINGW_PACKAGE_PREFIX}-python3-pandas"
            "${MINGW_PACKAGE_PREFIX}-python3-matplotlib"
            )
  optdepends=("${MINGW_PACKAGE_PREFIX}-python3-statsmodel: for some advanced statistical plots"
              "${MINGW_PACKAGE_PREFIX}-python3-beautifulsoup4: for getting dataset names"
            )

  cd "${srcdir}/python3-build-${CARCH}"
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python3 setup.py install --prefix=${MINGW_PREFIX} \
    --root="${pkgdir}" --optimize=1 --skip-build

  install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python3-${_realname}/LICENSE.txt"
}

package_mingw-w64-i686-python2-seaborn() {
  package_python2-seaborn
}

package_mingw-w64-i686-python3-seaborn() {
  package_python3-seaborn
}

package_mingw-w64-x86_64-python2-seaborn() {
  package_python2-seaborn
}

package_mingw-w64-x86_64-python3-seaborn() {
  package_python3-seaborn
}
